//
//  QLYDNetWork.h
//  Pods-QLYDNetWork_Example
//
//  Created by fb on 2020/12/4.
//

#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN

@interface QLYDNetWork : NSObject

/// update  http request headerFields
/// @param headers NSDictionary
+ (void)updateHeaderFields:(NSDictionary *)headers;
/**
 获取http headers请求头
 */
+ (NSDictionary *)getHttpHeaderFields;

/// A `POST` request.
/// @param urlString url
/// @param params Parameters
/// @param success A block object to be executed when the task finishes successfully.
/// @param fail A block object to be executed when the task finishes unsuccessfully.
+ (void)POST:(NSString*)urlString Parameters:(nullable id)params Success:(void (^)(id responseObject))success Fail:(void (^)(NSError *error))fail;

///   A `GET` request.
/// @param urlString url
/// @param params Parameters
/// @param success  A block object to be executed when the task finishes successfully.
/// @param fail A block object to be executed when the task finishes unsuccessfully.
+ (void)GET:(NSString*)urlString Parameters:(nullable id)params Success:(void (^)(id responseObject))success Fail:(void (^)(NSError *error))fail;


/// 文件上传
/// @param urlStr 上传地址
/// @param data 数据流
/// @param fileName 文件名称
/// @param fileTye 文件类型
/// @param upProgress 进度
/// @param success  http state 200 返回 block
/// @param fail http 非 200 返回 http 错误信息
+ (void)postUploadWithUrl:(NSString *)urlStr fileData:(NSData *)data fileName:(NSString *)fileName fileType:(NSString *)fileTye  progress:(nullable void (^)(NSProgress *uploadProgress)) upProgress success:(void (^)(id responseObject))success fail:(void (^)(NSError *error))fail;

/// 下载文件
/// @param urlStr urlStr :   下载文件的url地址
/// @param fileUrl 存放路径
/// @param downProgress 进度条
/// @param success 结果和文件路径
/// @param fail <#fail description#>
+ (void)downloadWithUrl:(NSString *)urlStr documentsDirectoryURL:(NSURL *)fileUrl progress:(nullable void (^)(NSProgress *downProgress))downProgress success:(void (^)(id responseObject,NSURL *filePath))success fail:(void (^)(NSError *error))fail;

@end

NS_ASSUME_NONNULL_END
